/*
 * @Description: 
 * @Author: 赵大壮
 * @Date: 2021-12-06 17:18:37
 * @LastEditTime: 2021-12-06 17:36:29
 * @LastEditors: 赵大壮
 */
import DZServiceGoods from "@/views/商品管理/service/DZServiceGoods";
import { Component, Vue, Inject } from "vue-property-decorator";
import DZServiceCoupon from "../service/DZServiceCoupon";
import UiDialogAddCoupon from "@/components/ui-dialog/UiDialogAddCoupon.vue"
import UiDialogListCoupon from "@/components/ui-dialog/UiDialogListCoupon.vue"
import DZModelBatch from "../model/DZModelBatch";
@Component({
    components: { UiDialogAddCoupon, UiDialogListCoupon }
})
export default class Index extends Vue {

    bool_dialog_create_batch = false;

    bool_dialog_show_coupon = false;

    s_coupon = new DZServiceCoupon();

    s_goods = new DZServiceGoods();

    created() {
        this.s_goods.net_list_goods_dic();
        this.action_list_batch();
    }

    mounted() {

    }

    beforeDestroy() {

    }

    action_list_batch() {
        this.s_coupon.net_list_batch();
    }

    action_cretate_batch(model: DZModelBatch) {
        this.s_coupon.m_batch = JSON.parse(JSON.stringify(model))
        this.s_coupon.net_add_batch(() => {
            this.bool_dialog_create_batch = false;
            this.action_list_batch();
        });
    }

    action_page_change(current) {
        this.s_coupon.m_page.page = current;
        this.action_list_batch();
    }

    action_list_coupon(id) {
        this.s_coupon.net_list_coupon(id, () => {
            this.bool_dialog_show_coupon = true;
        });
    }

    action_export_coupon(item) {
        this.s_coupon.net_export_coupon(item.name, item.id);
    }
}